"""
@author : linrh
@homepage : https://gitee.com/linrh-DUT
@version: 1.0.0
@when : 2023/5/24
@file: main.py
"""
import tkinter as tk
import tkinter.ttk as ttk

from frames.thesis_frame import ThesisFrame


class WordPreview:
    def __init__(self):
        self.window = tk.Tk()
        self.window.title('单词预习工具')
        screenWidth = self.window.winfo_screenwidth()  # 屏幕宽度
        screenHeight = self.window.winfo_screenheight()  # 屏幕高度
        w = 800
        h = 600
        x = (screenWidth - w) / 2
        y = (screenHeight - h) / 2
        self.window.geometry("%dx%d+%d+%d" % (w, h, x, y))  # 距离屏幕左上角(400, 200)
        self.window.resizable(width=False, height=False)
        self.tabs_init()
        self.window.mainloop()

    def tabs_init(self):
        tabs = ttk.Notebook(self.window)
        self.thesis_tab = tk.Frame(tabs)
        self.history_tab = tk.Frame(tabs)
        tabs.add(self.thesis_tab, text='论文统计')
        tabs.add(self.history_tab, text='历史学习')
        tabs.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
        ThesisFrame(self.thesis_tab)


if __name__ == '__main__':
    WordPreview()
